package com.seckill.goods.task.dynamic;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DynamicJob implements SimpleJob {

    /**
     * 实现对应的任务
     */
    @Override
    public void execute(ShardingContext shardingContext) {
        //获取请求的参数
        String id = shardingContext.getJobParameter();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
        String jobName = shardingContext.getJobName();
        System.out.println(jobName + "时间：" + simpleDateFormat.format(new Date()) + ":::" + id);
    }
}